package top.superflow.core.pool

import top.superflow.core.api.ShowSelf
import top.superflow.core.config.DefaultConfigurable
import top.superflow.core.pool.config.PoolConfig
import top.superflow.core.statis.Metrizable
import top.superflow.exception.UnInitializedException
import top.superflow.flow.config.Identifiable
import top.superflow.log.Loggable

trait Pool[C <: PoolConfig, T] extends DefaultConfigurable[C] with Identifiable with  Metrizable[scala.collection.Map[String, Any]]
                            with Loggable with ShowSelf{

  validateInit

  def getConfig : C

  def getResourceAction : ResourceAction [T]

  def getPoolAction : PoolAction

  def getPoolControl : PoolControl

  def getPoolStatus : PoolStatus


  def validateInit {
    if(getConfig == null){
      throw new UnInitializedException("The pool has not been initialized as the configuration is still null!")
    }
  }

}